package com.siblings.loan.utils.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import com.siblings.loan.R
import com.siblings.loan.databinding.DialogBindCardOnlyOneWarningTipsBinding
import com.siblings.loan.http.HttpHelper
import com.siblings.loan.utils.event.SibEventType

/**
 * Siblings
 * @Author wwdeng
 * @CreateTime: 2024/6/13 17:32
 * @Annotation：法语地区 审核中 && 只有一个账户  提示新增绑卡
 */
class BindCardOnlyOneWarningDialog: ProDialog {
    private lateinit var binding: DialogBindCardOnlyOneWarningTipsBinding
    private var mCallback: IDialogCallback? = null

    constructor(context: Context?) : super(context) {}
    constructor(context: Context?, callback: IDialogCallback?) : super(context) {
        mCallback = callback
    }

    /**
     * 设置点击回调
     */
    fun setOnClick(callback: IDialogCallback){
        this.mCallback = callback
    }

    override fun getRootView(): View {
        binding = DialogBindCardOnlyOneWarningTipsBinding.inflate(LayoutInflater.from(context))
        return binding.root
    }

    override fun initView() {
    }

    override fun initListener() {
        setOnClickListener(R.id.imgClose) //关闭
        setOnClickListener(R.id.btnAdd) //添加
    }

    override fun initData() {
    }

    override fun onViewClick(v: View?) {
        dismiss()
        if(mCallback != null){
            mCallback!!.onClick(v)
        }
    }

    interface IDialogCallback {
        //按钮点击
        fun onClick(view: View?)
    }

    override fun onStart() {
        super.onStart()
        HttpHelper.addSibEventAction(SibEventType.DIALOG.SIB_DIALOG_LOAN_AUDIT_ACCOUNT_ONLY_ONE_WARNING_SHOW,"")
    }

    override fun dismiss() {
        super.dismiss()
        HttpHelper.addSibEventAction(SibEventType.DIALOG.SIB_DIALOG_LOAN_AUDIT_ACCOUNT_ONLY_ONE_WARNING_DISMISS,"")
    }
}